import request from '@/config/axios'

class _Demo {
  test(): Ajax.PromiseAxiosResponse<Blob> {
    return request.get({
      url: '/api/system/user/downloadTranSketch?source=1',
      // responseType: 'blob',  // 关键配置项
      timeout: 600000,

    })
  }
}

export const DemoApi = new _Demo()


// 使用手册
class _DemoManual {
  testManual(): Ajax.PromiseAxiosResponse<Blob> {
    return request.get({
      url: '/api/system/user/downloadManual',
      responseType: 'blob',  // 关键配置项
      timeout: 600000
    })
  }
}

export const demoManual = new _DemoManual()


// 获取跳转地址
class _Companyurl {
  testUrl(): Ajax.PromiseAxiosResponse<void> {
    return request.get({
      url: '/api/work/cad/companyLoginUrl',
    })
  }
}

export const companyurl = new _Companyurl()

// 下载统计日志 - 定义查询参数类型
interface DownloadLogQuery {
  // 根据实际API参数定义，例如：
  type?: number
  source?: number
}
// 下载统计日志 - 定义响应数据类型（假设返回 { code: number; data: any; message?: string }）
interface ApiResponse<T = any> {
  code: number;
  data: T;
  message?: string;
}

// 下载统计日志
class LogStatisticsApi {
  downloadStatisticsLog(query: DownloadLogQuery): Promise<ApiResponse> {
    // downloadStatisticsLog(query: DownloadLogQuery): Ajax.PromiseAxiosResponse<ApiResponse> {
    return request.get({
      url: '/api/system/user/recordLog',
      params: query,
      timeout: 600000,
    })
  }
}
export const logStatisticsApi = new LogStatisticsApi()
